From: Andrew Cooper Date: Thu, 22 Jan 2015 11:44:03 +0000 (+0100) Subject: introduce domain_max_vcpus() helper and implement per arch X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3893 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=2f3dd9c8c6c0dabaac47e16ac47fbfc9fb695842;p=xen.git introduce domain_max_vcpus() helper and implement per arch This allows the common XEN_DOMCTL_max_vcpus handler to lose some x86-specific architecture knowledge. It turns out that Xen had the same magic number twice in-tree with different names (HVM_MAX_VCPUS and MAX_HVM_VCPUS). This removes all use of MAX_HVM_VCPUS, and x86 uses HVM_MAX_VCPUS from the public headers. Signed-off-by: Andrew Cooper Acked-by: Ian Campbell Acked-by: Jan Beulich --- diff --git a/xen/common/domctl.c b/xen/common/domctl.c index ee578c0042..33ecd454a0 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -608,8 +608,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) ret = -EINVAL; if ( (d == current->domain) || /* no domain_pause() */ - (max > MAX_VIRT_CPUS) || - (is_hvm_domain(d) && (max > MAX_HVM_VCPUS)) ) + (max > domain_max_vcpus(d)) ) break; /* Until Xenoprof can dynamically grow its vcpu-s array... */ diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h index 1b5a842ce0..3b23e0519d 100644 --- a/xen/include/asm-arm/config.h +++ b/xen/include/asm-arm/config.h @@ -48,7 +48,6 @@ #endif #define MAX_VIRT_CPUS 8 -#define MAX_HVM_VCPUS MAX_VIRT_CPUS #define asmlinkage /* Nothing needed */ diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index 8b7dd85274..9018c6a17c 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -249,6 +249,11 @@ struct arch_vcpu void vcpu_show_execution_state(struct vcpu *); void vcpu_show_registers(const struct vcpu *); +static inline unsigned int domain_max_vcpus(const struct domain *d) +{ + return MAX_VIRT_CPUS; +} + #endif /* __ASM_DOMAIN_H__ */ /* diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h index ad52d5b942..2fbd68d0b4 100644 --- a/xen/include/asm-x86/config.h +++ b/xen/include/asm-x86/config.h @@ -67,9 +67,6 @@ #define NR_CPUS 256 #endif -/* Maximum we can support with current vLAPIC ID mapping. */ -#define MAX_HVM_VCPUS 128 - /* Linkage for x86 */ #define __ALIGN .align 16,0x90 #define __ALIGN_STR ".align 16,0x90" diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 6a77a930ad..b233fbc2f0 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -9,6 +9,7 @@ #include #include #include +#include #define has_32bit_shinfo(d) ((d)->arch.has_32bit_shinfo) #define is_pv_32bit_domain(d) ((d)->arch.is_32bit_pv) @@ -527,6 +528,8 @@ void domain_cpuid(struct domain *d, unsigned int *ecx, unsigned int *edx); +#define domain_max_vcpus(d) (is_hvm_domain(d) ? HVM_MAX_VCPUS : MAX_VIRT_CPUS) + #endif /* __ASM_DOMAIN_H__ */ /*